package net.huashitong.Indicators.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sirdc.modules.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.huashitong.Indicators.dao.MonthlyCountDao;
import net.huashitong.Indicators.entity.MonthlyCount;
import net.huashitong.Indicators.entity.TertiaryIndustry;
import net.huashitong.Indicators.filter.MonthlyCountFilter;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;

@Service
public class MonthlyCountService extends StringPKService<MonthlyCount> {

	@Autowired
	private MonthlyCountDao dao;

	@Override
	protected BaseDao<MonthlyCount, String> getDao() {
		// TODO Auto-generated method stub
		return dao;
	}
	//获得分类和指标名
	public List getIndName(String aab001)
	{
		return dao.queryIndName(aab001);
	}
	//获取指标的相应数据
	public List<MonthlyCount> getIndInfo(String aab005,String bab001)
	{
		return dao.getIndInfo(aab005,bab001);
	}
	
	//统计查询
	public List<MonthlyCount> getInfoCount(String aab001,String aab003,String bab001)
	{
		return dao.getInfoCount(aab001,aab003,bab001);
	}
	//国民分类名称
	public List getCountName(String aab001)
	{
		return dao.getCountName(aab001);
	}
	
	//
	public List getNewMonth(String aab001 ){
		
		return dao.getNewMonth(aab001);
	}
	
	public List getnewMon(String aab005){
		return dao.getNewMon(aab005);
	}
	//历史数据
	public List<MonthlyCount> getHistory(MonthlyCountFilter filter){
		return dao.getHistoryData(filter);
	}
	//统计页面名称和ID
	public List queryCountNames() {
		
		return dao.queryCountNames();
	}

	public List getTwoClassDatas(MonthlyCountFilter filter)
	{
		return dao.queryTwoClassData(filter);
	}
	public List<Map> getThirdClassDatas(String id,String bab001 )
	{
		List<Map> list = new ArrayList<>();
		List<MonthlyCount> threedatas= dao.queryThirdClassData(id,bab001);
		for(MonthlyCount dtos: threedatas)
		{
			Map<String ,Object> map  =new HashMap<>();
			map.put("ThreeClassId",     StringUtils.isBlank(dtos.getAab005())?"": dtos.getAab005().trim());
			map.put("ThreeClaaName",  	StringUtils.isBlank(dtos.getAab006())?"": dtos.getAab006().trim());
			map.put("data",			  	StringUtils.isBlank(dtos.getBab001())?"": dtos.getBab001().trim());
			map.put("cumnlative",     	StringUtils.isBlank(dtos.getAab009())?"": dtos.getAab009().trim());//累计增长
			map.put("radio",		  	StringUtils.isBlank(dtos.getAab010())?"": dtos.getAab010().trim());//比上年同月增长
			map.put("MonthCumnlative",	StringUtils.isBlank(dtos.getAab016())?"": dtos.getAab016().trim());//当月值
			map.put("radioByYear",		StringUtils.isBlank(dtos.getAab017())?"": dtos.getAab017().trim());//比上年同年增长
			map.put("unit",				StringUtils.isBlank(dtos.getBab002())?"": dtos.getBab002().trim());
			map.put("increaseByMonth",	StringUtils.isBlank(dtos.getAab018())?"": dtos.getAab018().trim());
			map.put("increaseByYear",	StringUtils.isBlank(dtos.getAab019())?"": dtos.getAab019().trim());


			list.add(map);
		}

		return  list;
	}
}
